/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unesp.rc.lcpjcontacts.utils;

//import com.birosoft.liquid.LiquidLookAndFeel;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.*;


/**
 * The Class FrameUtils.
 *
 * @author aluno
 */
public class FrameUtils {

    /**
     * Instantiates a new frame utils.
     */
    private FrameUtils() {
    }

    /**
     * Center.
     *
     * @param f the f
     */
    public static void center(JFrame f) {
        Dimension screenSize =
                Toolkit.getDefaultToolkit().getScreenSize();
        f.setLocation(
                (screenSize.width - f.getWidth()) / 2,
                (screenSize.height - f.getHeight()) / 2);
    }

    /**
     * Center.
     *
     * @param f the f
     */
    public static void center(JDialog f) {
        Dimension screenSize =
                Toolkit.getDefaultToolkit().getScreenSize();
        f.setLocation(
                (screenSize.width - f.getWidth()) / 2,
                (screenSize.height - f.getHeight()) / 2);
    }

    /**
     * Sets the look windows.
     *
     * @param f the new look windows
     */
    public static void setLookWindows(JFrame f) {

        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (ClassNotFoundException ex) {
            System.out.println("Mensagem:" + ex.getMessage());
        } catch (InstantiationException ex) {
            System.out.println("Mensagem:" + ex.getMessage());
        } catch (IllegalAccessException ex) {
            System.out.println("Mensagem:" + ex.getMessage());
        } catch (UnsupportedLookAndFeelException ex) {
            System.out.println("Mensagem:" + ex.getMessage());
        }

        SwingUtilities.updateComponentTreeUI(f);
    }
}
